<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

//后台
Route::group(['middleware'=>['check.login'],'prefix'=>'admin','namespace'=>'Admin'], function() {
    Route::get('', 'IndexController@index');
    Route::get('index', 'IndexController@index');
    Route::get('logout', 'LoginController@logout');
    Route::get('authorlogout','LoginController@authorLogout');
    /*分类*/
    Route::get('category/{type}','CategoryController@manageCategory');
    Route::post('updatecategorystatus','CategoryController@updateCategoryStatus');
    Route::post('deletecategory','CategoryController@deleteCategory');
    Route::post('updatecategory','CategoryController@updateCategory');
    Route::post('addcategory','CategoryController@addCategory');
    /*文章*/
    Route::match(['get','post'],'addarticle','ArticleController@addArticle');
    Route::match(['post','get'],'artilelist/{status}','ArticleController@articleList');
    Route::post('deletearticle','ArticleController@deleteArticle');
    Route::get('editarticle/{articleid}','ArticleController@editArticle');
    Route::post('updatearticlestatus','ArticleController@updateArticleStatus');
    Route::post('multiupdatearticlestatus','ArticleController@multiUpdateArticleStatus');
    Route::post('multideletearticle','ArticleController@multiDeleteArticle');
    Route::post('updatearticle','ArticleController@updateArticle');
    /*图片*/
    Route::match(['get','post'],'addimg','ImageController@addImg');
    Route::match(['get','post'],'imglist/{status}','ImageController@imgList');
    Route::post('updateimagestatus','ImageController@updateImageStatus');
    Route::post('deleteimage','ImageController@deleteImage');
    Route::get('editimg/{id}','ImageController@editImg');
    Route::post('deleteoneimg','ImageController@deleteOneImg');
    Route::post('updateimg','ImageController@updateImg');
    /*视频*/
    Route::match(['get','post'],'addvideo','VideoController@addVideo');
    Route::match(['post','get'],'videolist/{status}','VideoController@videoList');
    Route::post('updatevideostatus','VideoController@updateVideoStatus');
    Route::post('multiupdatevideostatus','VideoController@multiUpdateVideoStatus');
    Route::post('multideletevideo','VideoController@multiDeleteVideo');
    Route::post('deletevideo','VideoController@deleteVideo');
    Route::get('editvideo/{videoid}','VideoController@editVideos');
    Route::post('updatevideo','VideoController@updateVideo');
    /*用户*/
    Route::match(['get','post'],'userlist','UserController@userList');
    Route::post('updateuserstatus','UserController@updateUserStatus');
    Route::post('authormore','UserController@authorMore');
    Route::post('updateauthoris_author','UserController@updateAuthorIs_author');
    Route::match(['get','post'],'authorlist','UserController@authorList');
    /*管理员*/
    Route::match(['get','post'],'admininfo','AdminController@adminInfo');
    Route::match(['get','post'],'authorinfo','UserController@authorInfo');
    Route::match(['get','post'],'inbox','QuestionController@inBox');
    Route::post('deletequestion','QuestionController@deleteQuestion');
    /*设置*/
    Route::match(['get','post'],'settings','SettingController@settings');
    Route::post('database','AdminController@backDB');
    /*获取评论*/
    Route::post('getcomment','CommentController@getComment');
    Route::post('updatecomment','CommentController@updateComment');
    Route::post('deletecomment','CommentController@deleteComment');
    /*公告*/
    Route::get('notice','NoticeController@notice');
    Route::post('addnotice','NoticeController@addNotice');
    Route::post('updatenoticestatus','NoticeController@updateNoticeStatus');
    Route::post('deletenotice','NoticeController@deleteNotice');

});
//后台登录，验证码
Route::match(['post','get'],"admin/login","Admin\LoginController@login");
Route::match(['post','get'],"admin/authorlogin","Admin\LoginController@authorLogin");
Route::get('admin/verify','Admin\LoginController@verify');
//申请作者
Route::match(['post','get'],'application','Admin\ApplicationController@index');
Route::match(['post','get'],'application1','Admin\ApplicationController@index1');
Route::match(['post','get'],'application2','Admin\ApplicationController@index2');
Route::match(['post','get'],'application3','Admin\ApplicationController@index3');
Route::get('getaddress/{pid}','Admin\ApplicationController@getAddress');
/*问题反馈*/
Route::post('admin/addquestion','Admin\QuestionController@addQuestion');

Route::group(['middleware'=>['check.login'],'prefix'=>'admin'], function() {
    Route::post('uploadimg','UploadController@uploadImg');
});
Route::group(['middleware'=>['check.user.login']], function() {
    Route::post('uploadimg','UploadController@uploadImg');
});
//前台
Route::group(['namespace'=>'Home'],function(){
    Route::match(['post','get'],'login','LoginController@login');
    Route::match(['post','get'],'register','LoginController@register');
    Route::match(['post','get'],'forget','LoginController@forget_pass');
    Route::get('chagepass','LoginController@chagePass');
    Route::get('active','LoginController@active');
    Route::post('updatepass','LoginController@updatePass');
    Route::get('articledetail/{id}','IndexController@articleDetail');
    Route::get('imagedetail/{id}','IndexController@imageDetail');
    Route::get('indexlist/{page}','IndexController@indexList');
    Route::get('articlelist/{page}/{category_id?}','IndexController@articleList');
    Route::get('getalist/{page}/{category_id?}','IndexController@getAList');
    Route::get('getilist/{page}/{category_id?}','IndexController@getIList');
    Route::get('imagelist/{page}/{category_id?}','IndexController@imageList');
    Route::post('insertcomment','IndexController@insertComment');
    Route::get('commentdetail/{id}','IndexController@commentDetail');
});

/*个人中心等需要登录的*/
Route::group(['middleware'=>['check.user.login'],'namespace'=>'Home'], function() {
    Route::get('usercenter','UserController@userCenter');
    Route::post('setavatar','UserController@setAvatar');
    Route::post('unstar','UserController@unstar');
    Route::get('starai/{page}','UserController@starAI');
    Route::get('starais/{page}','UserController@starAIs');
    Route::post('modifyuser','UserController@modifyUser');
    Route::get('userarticle/{page}','UserController@userArticle');
    Route::get('userarticles/{page}','UserController@userArticles');
    Route::get('attention','UserController@attention');
    Route::get('authorarticle/{author_id}/{page}','UserController@authorArticle');
    Route::get('authorarticles/{author_id}/{page}','UserController@authorArticles');
    Route::get('logout','UserController@logOut');
    Route::post('read','UserController@read');
});

//前台首页
Route::get('index','Home\IndexController@index');
Route::get('/','Home\IndexController@index');
Route::get('search','Home\IndexController@search');
Route::post('star','Home\UserController@star');
